package com.halachawiki.shared;

import java.io.Serializable;

// this class is mutable once create. However, for some funny reason
// GWT doesn't serialize final fields, so fields are not marked final.
public class ApproxDate implements Serializable {

	public ApproxDate() { 
		startYear = -5000;
		endYear = -5000;
		accuracy = Accuracy.YEAR_RANGE;		
	}
	public ApproxDate(int startYear) {
		accuracy = Accuracy.YEAR;
		this.startYear = startYear;
		endYear = startYear;
	}
	public ApproxDate(int startYear, int endYear) {
		accuracy = Accuracy.YEAR_RANGE;
		this.startYear = startYear;
		this.endYear = endYear;
	}
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public enum Accuracy {
		YEAR,
		YEAR_RANGE
	}
	
	public Accuracy getAccuracy() { return accuracy; }
	public int getStartYear() { return startYear; }
	public int getEndYear() { return endYear; }
	private Accuracy accuracy;
	private int startYear; // If Exact, contains exact date. If Century, start of century
	private int endYear;   // Only relevant if Accuracy == RANGE
}
